package com.jake.date;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class JDK8DateUtils {

    private static final String YEAR_MONTH_DAY_HOUR_MINUTE = "yyyy-MM-dd HH:mm";

    private static DateTimeFormatter dtfMinute = DateTimeFormatter.ofPattern(YEAR_MONTH_DAY_HOUR_MINUTE);

    /**
     * @return 获取当前日期yyyy-MM-dd
     */
    public static String getCurrentDateStr() {
        return LocalDate.now().toString();
    }

    /**
     * @return 获取当前时间的整点时间字符串yyyy-MM-dd HH:00
     */
    public static String getCurrentZeroMinuteStr() {
        return DateTimeFormatter.ofPattern("yyyy-MM-dd HH:00").format(LocalDateTime.now());
    }
}
